fix multiphysics medium attribute lookup#2468
Conversation
|
That this was not caught by the unit tests should be motivation for us to improve on that 😊 |
648268e to
a25dcb4
Compare
|
Noticed another issue: if |
daquinteroflex
left a comment
There was a problem hiding this comment.
Thanks a lot Yannick!
|
|
a25dcb4 to
b869a15
Compare
|
@frederikschubertflex oh sorry didnt see your edit, I added some tests now and force pushed! feel free to add more, I got a little bit confused. actually I still don't understand the root cause of the error I was seeing on my pydantic v2 branch. there, the |
|
No, worries! I just figured that you have other things on your plate :) I will look into this in more depth later! |
|
ok maybe just to conclude this discussion: |
The custom
__getattr__from #2431 intercepts every missing-attribute lookup, including internals such as_cached_properties. During model construction or when a@cached_propertyis accessed, Pydantic tries to read that attribute, hits this handler, and raises, breaking any code path that touched cached properties. This surfaced in #2433 because that PR makes the_cached_propertiesfields aPrivateAttr, but this problem is also present ondevelopfor any Pydantic internal field.This PR addresses that by delegating all unresolved lookups (fields, cached props, dunders) back to Pydantic before our own logic runs.